package com.briup.cms.service.impl;

import com.briup.cms.bean.Role;
import com.briup.cms.dao.RoleMapper;
import com.briup.cms.service.IRoleService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class RoleServiceImpl implements IRoleService {
    @Resource
    private RoleMapper roleMapper;

    @Override
    public List<Role> findAll() {
        return roleMapper.selectAll();
    }
    @Override
    public void saveOrUpdate(Role role) {
        if(role.getId()!=null){
            roleMapper.update(role);
        } else {
            roleMapper.insert(role);
        }
    }

    @Override
    public void deleteById(long id) {
        roleMapper.deleteById(id);
    }

}
